home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / dev / ds5000.md / devFsOpTable.c < prev    next >
C/C++ Source or Header  |  1991-03-19  |  5KB  |  186 lines

  1. /* 
  2.  * devFsOpTable.c --
  3.  *
  4.  *    The operation tables for the file system devices.  
  5.  *
  6.  *    Copyright (C) 1989 Digital Equipment Corporation.
  7.  *    Permission to use, copy, modify, and distribute this software and
  8.  *    its documentation for any purpose and without fee is hereby granted,
  9.  *    provided that the above copyright notice appears in all copies.  
  10.  *    Digital Equipment Corporation makes no representations about the
  11.  *    suitability of this software for any purpose.  It is provided "as is"
  12.  *    without express or implied warranty.
  13.  */
  14.  
  15. #ifndef lint
  16. static char rcsid[] = "$Header: /sprite/src/kernel/dev/ds5000.md/RCS/devFsOpTable.c,v 1.2 91/03/19 11:01:11 jhh Exp $ SPRITE (Berkeley)";
  17. #endif not lint
  18.  
  19.  
  20. #include <sprite.h>
  21. #include <dev.h>
  22. #include <devInt.h>
  23. #include <fs.h>
  24. #include <rawBlockDev.h>
  25. #include <devFsOpTable.h>
  26. #include <devTypes.h>
  27.  
  28. /*
  29.  * Device specific include files.
  30.  */
  31.  
  32. #include <devSyslog.h>
  33. #include <devNull.h>
  34. #include <devSCSIDisk.h>
  35. #include <devSCSITape.h>
  36. #include <devNet.h>
  37. #include <devBlockDevice.h>
  38. #include <scsiHBADevice.h>
  39. #include <raidExt.h>
  40. #include <tty.h>
  41. #include <graphics.h>
  42. #include <devStdFBInt.h>
  43.  
  44. static ReturnStatus NoDevice();
  45. static ReturnStatus NullProc();
  46.  
  47. #ifdef SERIALB_DEBUG
  48. extern ReturnStatus Dev_serialBOutTrace();
  49. extern ReturnStatus Dev_serialBInTrace();
  50. #endif
  51.  
  52.  
  53. /*
  54.  * Device type specific routine table:
  55.  *    This is for the file-like operations as they apply to devices.
  56.  *    DeviceOpen
  57.  *    DeviceRead
  58.  *    DeviceWrite
  59.  *    DeviceIOControl
  60.  *    DeviceClose
  61.  *    DeviceSelect
  62.  *    DeviceMMap
  63.  */
  64.  
  65.  
  66. DevFsTypeOps devFsOpTable[] = {
  67.     /*
  68.      * Serial lines used to implement terminals.
  69.      */
  70.     {DEV_TERM,       DevTtyOpen, DevTtyRead, DevTtyWrite,
  71.              DevTtyIOControl, DevTtyClose, DevTtySelect,
  72.              DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  73.     /*
  74.      * The system error log.  If this is not open then error messages go
  75.      * to the console.
  76.      */
  77.     {DEV_SYSLOG,    Dev_SyslogOpen, Dev_SyslogRead, Dev_SyslogWrite,
  78.             Dev_SyslogIOControl, Dev_SyslogClose, Dev_SyslogSelect,
  79.             DEV_NO_ATTACH_PROC, Dev_SyslogReopen, NullProc},
  80.     /*
  81.      * SCSI Worm interface.
  82.      */
  83.     {DEV_SCSI_WORM, NoDevice, NullProc, NullProc,
  84.             NullProc, NullProc, NullProc, 
  85.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  86.     /*
  87.      * The following device number is unused.
  88.      */
  89.     {DEV_PLACEHOLDER_2, NoDevice, NullProc, NullProc,
  90.             NullProc, NullProc, NullProc, 
  91.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  92.     /*
  93.      * New SCSI Disk interface.
  94.      */
  95.     {DEV_SCSI_DISK, DevRawBlockDevOpen, DevRawBlockDevRead,
  96.             DevRawBlockDevWrite, DevRawBlockDevIOControl, 
  97.             DevRawBlockDevClose, Dev_NullSelect, DevScsiDiskAttach,
  98.             DevRawBlockDevReopen, NullProc},
  99.     /*
  100.      * SCSI Tape interface.
  101.      */
  102.     {DEV_SCSI_TAPE, DevSCSITapeOpen, DevSCSITapeRead, DevSCSITapeWrite,
  103.             DevSCSITapeIOControl, DevSCSITapeClose, Dev_NullSelect,
  104.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  105.     /*
  106.      * /dev/null
  107.      */
  108.     {DEV_MEMORY,    NullProc, Dev_NullRead, Dev_NullWrite,
  109.             Dev_NullIOControl, NullProc, Dev_NullSelect,
  110.             DEV_NO_ATTACH_PROC, NullProc, NullProc},
  111.     /*
  112.      * Xylogics 450 disk controller.
  113.      */
  114.     {DEV_XYLOGICS, NullProc, Dev_NullRead, 
  115.            Dev_NullWrite, Dev_NullIOControl, 
  116.            NullProc, Dev_NullSelect, 
  117.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  118.     /*
  119.      * Network devices.  The unit number specifies the ethernet protocol number.
  120.      */
  121.     {DEV_NET,      DevNet_FsOpen, DevNet_FsRead, DevNet_FsWrite, 
  122.            DevNet_FsIOControl, DevNet_FsClose, DevNet_FsSelect,
  123.            DEV_NO_ATTACH_PROC, DevNet_FsReopen, NullProc},
  124.     /*
  125.      * Raw SCSI HBA interface.
  126.      */
  127.     {DEV_SCSI_HBA, DevSCSIDeviceOpen, Dev_NullRead, Dev_NullWrite,
  128.                     DevSCSIDeviceIOControl, DevSCSIDeviceClose, Dev_NullSelect,
  129.                     DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  130.     /*
  131.      * RAID device.
  132.      */
  133.     {DEV_RAID, NullProc, Dev_NullRead,
  134.            Dev_NullWrite, Dev_NullIOControl,
  135.            NullProc, Dev_NullSelect,
  136.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  137.  
  138.     /*
  139.      * Debug device. (useful for debugging RAID device)
  140.      */
  141.     {DEV_DEBUG, NullProc, Dev_NullRead,
  142.            Dev_NullWrite, Dev_NullIOControl,
  143.            NullProc, Dev_NullSelect,
  144.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  145.  
  146.     /*
  147.      * The graphics device.
  148.      */
  149.     {DEV_MOUSE, DevGraphicsOpen, DevGraphicsRead, DevGraphicsWrite,
  150.            DevGraphicsIOControl, DevGraphicsClose, DevGraphicsSelect,
  151.            DEV_NO_ATTACH_PROC, NoDevice, NullProc}, 
  152.     /*
  153.      * These devices don't exist on a ds5000.
  154.      */
  155.     {13, NullProc, NullProc, NullProc, NullProc, NullProc, NullProc, 
  156.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  157.     {14, NullProc, NullProc, NullProc, NullProc, NullProc, NullProc, 
  158.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  159.     {15, NullProc, NullProc, NullProc, NullProc, NullProc, NullProc, 
  160.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  161.     {16, NullProc, NullProc, NullProc, NullProc, NullProc, NullProc, 
  162.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  163.     /*
  164.      * The standard frame buffer device.
  165.      */
  166.     {DEV_STDFB, DevStdFBOpen, NullProc, NullProc,
  167.             DevStdFBIOControl, DevStdFBClose, NullProc, 
  168.             DEV_NO_ATTACH_PROC, NoDevice, DevStdFBMMap},
  169. };
  170.  
  171. int devNumDevices = sizeof(devFsOpTable) / sizeof(DevFsTypeOps);
  172.  
  173.  
  174. static ReturnStatus
  175. NullProc()
  176. {
  177.     return(SUCCESS);
  178. }
  179.  
  180.  
  181. static ReturnStatus
  182. NoDevice()
  183. {
  184.     return(FS_INVALID_ARG);
  185. }
  186.